package worktools.service;

import worktools.entity.RecordListEntity;
import worktools.entity.RecordUpdDNSEntity;
import worktools.utils.CommUtils;
import worktools.utils.DNSUtils;

/**
 * Created by bearworker on 17-4-4.
 */
public class DnsService {

    public void updateDNS(){
        String pubip = CommUtils.getPubNetIp();

        RecordListEntity entity = DNSUtils.getList("bearworker.com","","",0,0);

        for(RecordListEntity.Records record : entity.getRecords()){
            if (!pubip.equalsIgnoreCase(record.getValue()) && "A".equals(record.getType())){
                RecordUpdDNSEntity updDNSEntity = DNSUtils.updDNS("bearworker.com",record.getId(),record.getName(),record.getLine(),record.getLine_id(),pubip);
                System.out.println(updDNSEntity.getRecord().getName()+"||"+updDNSEntity.getStatus().getMessage());
            }
        }
    }
}
